home *** CD-ROM | disk | FTP | other *** search
- #!/bin/vtcl
- # ---------------------------------------------------------------------
- # Copyright 1994 by SCO, Inc.
- # Permission to use, copy, modify, distribute, and sell this software
- # and its documentation for any purpose is hereby granted without fee,
- # provided that the above copyright notice appear in all copies and that
- # both that copyright notice and this permission notice appear in
- # supporting documentation, and that the name of SCO not be used in
- # advertising or publicity pertaining to distribution of the software
- # without specific, written prior permission. SCO makes no
- # representations about the suitability of this software for any
- # purpose. It is provided "as is" without express or implied warranty.
- # ---------------------------------------------------------------------
-
- # Demo : short.tcl
- # Description : Silly demo of how to use point help a la the
- # -shortHelpCallback option.
- #
-
- # Close connection and exit Vtcl interpreter.
- proc CloseCB { cbs } {
- VtClose; exit 0
- }
-
- # We need to deal with case when vtcl is not in a standard place
- if { [ catch { set pixDir $env(VTCL_HOME)/pixmaps } errorMsg ] != 0 } {
- # VTCL_HOME is not set; assume standard place
- set pixDir /lib/vtcl/pixmaps
- }
-
- set pixList [list check.px dir.px file.px newicon.px odir.px exec.px]
- set origExpressionsList [list oops! umph! uh-oh! "on no!" phooey! whoa! bummer!]
- set expressionsList $origExpressionsList
-
- proc SwitchPixMapCB {cbs} {
- global pixList expressionsList origExpressionsList oopsLbl pixDir
- set newPix [lvarpop pixList]
- set widget [keylget cbs widget]
- VtSetValues $widget -pixmap $pixDir/$newPix
- lvarpush pixList $newPix len
- if { [llength $expressionsList] != 0 } {
- VtSetValues $oopsLbl -label [lvarpop expressionsList]
- } else {
- # re-load
- set expressionsList $origExpressionsList
- }
- }
-
- set app [VtOpen joe]
- set mainForm [VtFormDialog $app.mainForm \
- -title "Short Stuff" \
- -ok \
- -okCallback CloseCB \
- ]
-
- set lbl [VtLabel $mainForm.lbl \
- -label "Put your mouse over\nan elusive pixmap!" \
- ]
- set rowCol [VtRowColumn $mainForm.rowcol \
- -topSide $lbl \
- -numColumns 3 \
- -vertical \
- ]
- foreach item $pixList {
- set itemName [lindex [split $item . ] 0 ]
- VtLabel $rowCol.$itemName \
- -pixmap $pixDir/$item \
- -shortHelpCallback SwitchPixMapCB
- }
- set oopsLbl [VtLabel $mainForm.oops \
- -topSide $rowCol \
- -label " " \
- -xmArgs "background white" \
- ]
- VtShow $mainForm
- VtMainLoop
-